package com.wh1200.xmlless.test.model

import org.apache.ibatis.type.BaseTypeHandler
import org.apache.ibatis.type.JdbcType
import java.sql.CallableStatement
import java.sql.PreparedStatement
import java.sql.ResultSet

/**
 * for test
 * @author 吴昊
 * @since 0.0.6
 */
class StringTypeHandler : BaseTypeHandler<String>() {

  override fun getNullableResult(rs: ResultSet, columnName: String?): String? {
    return rs.getString(columnName)
  }

  override fun getNullableResult(rs: ResultSet, columnIndex: Int): String? {
    return rs.getString(columnIndex)
  }

  override fun getNullableResult(cs: CallableStatement, columnIndex: Int): String? {
    return cs.getString(columnIndex)
  }

  override fun setNonNullParameter(ps: PreparedStatement, i: Int, parameter: String?, jdbcType: JdbcType?) {
    ps.setString(i, parameter)
  }

}
